package com.supermap.business.product;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtils;
import com.supermap.dubbo.api.product.GridProductFromChnService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:zhoujian
 * @Desciption:
 * @date:2019-04-18 10:59
 * @version:v1.0.0
 */
@RestController
@RequestMapping("gridProduct")
public class GridPoductController {

    @Reference(timeout =10000)
    private GridProductFromChnService gridProductFromChnService;

    @GetMapping("/catalog")
    public JSONUtils firstCatalog(String type , String areaCode)
    {
        return  gridProductFromChnService.firstCatalog(type,areaCode);
    }
    @GetMapping("/selectElementByCatalog")
    public JSONUtils selectElementByCatalog(@RequestParam(value="catalog") String catalog , String areaCode)
    {
        return gridProductFromChnService.selectElementByDataContent(catalog,areaCode);
    }

    @GetMapping("/selectProductListByCataEleArea")
    public JSONUtils selectProductListByCataEleArea(@RequestParam(value = "catalog") String catalog ,
                                                    @RequestParam(value = "elementCode") String elementCode ,
                                                    @RequestParam(value = "areaCode") String areaCode)
    {
        return gridProductFromChnService.selectProductByContentElementArea(catalog, elementCode, areaCode);
    }

}